package com.atguigu.yygh.hosp.controller.admin;

import com.atguigu.yygh.hosp.service.ScheduleService;
import com.atguigu.yygh.model.hosp.Schedule;
import com.atguigu.yygh.result.R;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * @author A
 * @version 1.0
 * @description: TODO
 * @date 2025/3/18 2:53
 */
@RestController
@RequestMapping("/admin/hosp/schedule")
public class ScheduleController {
    @Autowired
    private ScheduleService scheduleService;
    @GetMapping("/getScheduleRule/{page}/{limit}/{hoscode}/{depcode}")
    public R getScheduleRule(@PathVariable("page") Integer page,@PathVariable("limit") Integer limit,@PathVariable("hoscode") String hoscode,@PathVariable("depcode") String depcode){
        Map<String,Object> map = scheduleService.getScheduleRule(page,limit,hoscode,depcode);
        return R.ok().data(map);
    }
    //根据医院编号 、科室编号和工作日期，查询排班详细信息
    @ApiOperation("根据医院编号 、科室编号和工作日期，查询排班规则")
    @GetMapping("/getScheduleInfo/{hoscode}/{depcode}/{workDate}")
    public R getScheduleInfo(@PathVariable("hoscode") String hoscode,@PathVariable("depcode") String depcode,@PathVariable("workDate") String workDate){
        List<Schedule> scheduleList =scheduleService.getScheduleInfo(hoscode,depcode,workDate);
        return R.ok().data("list",scheduleList);
    }
}
